<template>
  <div class="view-header">
    <div class="container">
      <span class="page-title" v-show="type === 'student'">添加班级</span>
      <span class="page-title" v-show="type === 'teacher'">创建班级课程</span>
      <el-button class="button button-red-hollow pull-right"
              @click="shutDown">关闭</el-button>
    </div>
  </div>
</template>

<script>
export default {
  data(){
    return{
      type: '',
    }

  },
  created() {


    this.init()
  },

  methods:{

    async init(){
      this.type = localStorage.getItem("type")
    },

    // 关闭
    shutDown(){
      if(this.type === 'student'){
        this.$router.push({
          name: 'studentIndex'
        }).catch(r => console.log(r))
      }
      if(this.type === 'teacher'){
        this.$router.push({
          name: 'teacherIndex'
        }).catch(r => console.log(r))
      }
      if(this.type === 'admin'){
        this.$router.push({
          name: 'adminIndex'
        }).catch(r => console.log(r))
      }


    }
  }
}
</script>

<style scoped>

*, :after, :before {
  box-sizing: border-box;
}

div {
  display: block;
  unicode-bidi: isolate;
}
.view-header {
  left: 0;
  background-color: #fff;
  box-shadow: 0 0 10px rgba(0,0,0,.15);
  position: fixed;
  z-index: 10;
  top: 0;
  width: 100%;
  height: 48px;
  line-height: 48px;
}
.container {
  padding-right: 15px;
  padding-left: 15px;
  margin-right: auto;
  margin-left: auto;
  width: 1170px;
}
.page-title {
  font-size: 18px;
  font-weight: 700;
}
.pull-right {
  float: right !important;
}
.button {
  margin: 0;
  color: #7691fc;
  margin-top: 7px;
  background-color: #fff;
  padding: 0 10px;
  border-radius: 4px;
  border: 1px solid #e3e3e9;
  display: inline-block;
  min-width: 80px;
  height: 32px;
  line-height: 30px;
  font-size: 14px;
  outline: none;
  vertical-align: middle;
  font-family: inherit;
  overflow: visible;
}
.button-red-hollow:hover {
  border-color: #7691fc;
}
.button-red-hollow:active {
  color: #fff;
}
</style>